<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/jsp/taglibs.jsp"%>
<head>
	<title>政府网上采购管理系统</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<link href="${ctx}/commons/css/login_css.css" rel="stylesheet"/>
		<link rel="shortcut icon" href="${ctx }/website/homepage/favicon.ico"> 
		<link rel="stylesheet" type="text/css" href="${ctx}/commons/themes/default/easyui.css"/>
		<!-- jqueryUI JS文件的引入 -->
		<script type="text/javascript" src="${ctx}/commons/js/jquery-1.8.0.min.js"></script>
		<script type="text/javascript" src="${ctx}/commons/js/jquery.easyui.min.js"></script>
		<!-- easyUI验证扩展，增加自定义验证, 一定要放在最后-->
		<script type="text/javascript" src="${ctx}/commons/js/easyui-extends-validate.js"></script>
		<!-- 开发国际化的引用，主要完成后台信息在前台提示的国际化，一定要放在最后 -->
		<script type="text/javascript">var ctx = '${ctx}';var actionExt = "action";var i18n = new Object();</script>
		<script src="${ctx}/commons/js/i18n/message_zh_CN.js" type="text/javascript"></script>
		<script type="text/javascript">
		$(function(){
			var h = $(window).height();
			var autoH = (h-400)/2;
			$("#login_table").css("margin-top",autoH + "px");
			$("#login_page").show();
			$(window).keydown(function(event){
				if(event.keyCode==13){
					$("#okBtn").click();
				}
			});
			$("#okBtn").click(function(){
				submitLogin();
			});
			//给用户名输入框绑定样式和验证条件
			$('#loginName').validatebox({
				required: true,
				validType:['isNull'],
				missingMessage:'请输入登录名'
			});
			//给密码框绑定验证条件
			$('#passWord').validatebox({
				required: true,
				validType:['minLength[6]', 'isNull'],
				missingMessage:'请输入密码'
			});
			$("#loginName").focus();
		});
		
		function submitLogin(){
			if(!$('#loginForm').form('validate')){
					return false;
			}
			// 阻止重复提交
			$('#okBtn').attr("disabled", "disabled");
			$("#loginName").unbind("keydown");
			$("#passWord").unbind("keydown");
			var param = $("#loginForm").serialize();
			$.ajax({
				type: "post",
				timeout:30000,
				url:  "${ctx}/user-login-sys-new/userlogin",
				data: param,
				success: function(String){
					if(String == 'registerUnAuditPass'){
						window.location.href = "${ctx}/user-login-sys-new/unPassRegisterInfo";
					}else if(String == 'userLoginSuccess'){
						window.location.href = "${ctx}/portal/index.jsp";
					}else if(String == 'userNoExist'){
						$.messager.show({
							title:'提示',
							timeout:5000,
							msg:'此用户名不存在!',
							showType:'slide'
						});
						 $(function(){
                            // setTimeout(function () { window.location.reload();},1200);
                             $("#loginName").val('');
							 $("#passWord").val('');
				    		 $('#okBtn').removeAttr("disabled");
							
                           });		
					    }else if(String == 'pswNoRight'){
					    	$.messager.show({
								title:'提示',
								timeout:5000,
								msg:'密码错误!',
								showType:'slide'
							});
					    	 $(function(){
	                            // setTimeout(function () { window.location.reload();},1200);
					    		 $("#passWord").val('');
					    		 $('#okBtn').removeAttr("disabled");
	                         });	
					    }else if(String == 'loginTypeError'){
					    	$.messager.show({
								title:'提示',
								timeout:5000,
								msg:'登录方式不匹配，请切换CA登录!',
								showType:'slide'
							});
					//	$.messager.alert('提示','登录方式不匹配，请切换CA登录!','warning');
					    }else{
					 //   $.messager.alert('提示','非投标人仅限CA登录,请切换CA登录!','warning');
			    		 $.messager.show({
								title:'提示',
								timeout:5000,
								msg:'登录方式不匹配，请切换CA登录!',
								showType:'slide'
							});
					}
				},
				error: function(){
					$('#okBtn').removeAttr("disabled");
					$.messager.show({
						title:'提示',
						timeout:5000,
						msg:'登录失败!',
						showType:'slide'
					});
					//$.messager.alert('提示','登录失败！','warning');
					$("#loginName").focus();
					 $(function(){
                       //  setTimeout(function () { window.location.reload();},1200);
						     $("#loginName").val('');
							 $("#passWord").val('');
				    		 $('#okBtn').removeAttr("disabled");
                     });	
				}
			});
		 }
		 
		 function changeToCA(){
		   window.location = "${ctx}/user-login-sys-new/loginCA";
		 }
	</script>
</head>

<body>
<center id="login_page" style="display: none;">
	<form action="" id="loginForm" method="post">
  <table width="530" id="login_table" height="320" border="0" cellspacing="0" cellpadding="0" background="../commons/images/login/table_bg.png">
    <tbody>
    <tr>
      <td colspan="2" width="70%" style="padding-top: 24px;padding-left: 30px;" align="left" valign="top"><img src="../commons/images/login/logo2.png" alt="" width="350" height="56"></td>
    </tr>
    <tr>
      <td align="right" width="120" height="50">用户名：
        <label for="textfield"></label>
      </td>
      <td align="left" >
        <input type="text" name="loginName" id="loginName">
      </td>
      <td rowspan="2" >
      <div style="padding-left:1px;height:35px; width:50px;" >
        <a href="javascript:void(0)" id="changeToCA" onclick="changeToCA()" style="text-decoration:none"
         onfocus="document.getElementById('passWord').focus();">
      <img src="${ctx}/commons/images/switch.png" border="0" width="50px"/><br>&nbsp;CA登录</br><br></br><br></br></a></div>
      </td>
    </tr>
     <tr>
      <td align="right" width="120" height="50">密&nbsp;&nbsp;码：</td>
      <td align="left">
        <input type="password" name="passWord" id="passWord">
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center" height="30" >
	      <div class="submit" >
	         <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)"><img src="${ctx}/commons/images/login/submit.png" alt="C A 登 录" title="C A 登 录" border="0" id="okBtn" /></a></span>
	      </div>
      </td>
    </tr>
    <tr>
      <td colspan="2" height="80">&nbsp;</td>
    </tr>
  </tbody></table></form>

  <p>&nbsp;</p>
<table width="80%" border="0" cellspacing="0" style="letter-spacing: 2px;line-height: 20px;" cellpadding="0">
  <tbody><tr>
    <td align="center" valign="middle"><div id="footer">
      <p>主办单位：包河区政府采购中心　　联系电话：0551-63357535　　</p>
      <p><a href="${ctx}/file_resource/Active.zip">控件驱动下载（请使用IE8以上版本浏览器登录）</a> 联系地址：包河区政务服务中心3楼</p>
    </div></td>
  </tr>
</tbody></table>
</center>
</body>
</html>
